window.onload = getallopt();
function getallopt() {
        const getallopt = new XMLHttpRequest();
        getallopt.open('GET','http://localhost:5000/system')
        getallopt.send(null);
        getallopt.onreadystatechange = function () {
                if (getallopt.readyState == 4){
                        let allopt = getallopt.response;
                        allopt = JSON.parse(allopt);
                        console.log(allopt);
                        for (let i = 0; i<allopt.length; i++){
                                if (allopt[i].opttypes=='username'){
                                        document.getElementById("username").options.add(new Option(allopt[i].optvalues,allopt[i].optvalues));
                                }
                                if (allopt[i].opttypes=='devicegroups'){
                                        document.getElementById("Groups").options.add(new Option(allopt[i].optdesc,allopt[i].optvalues));
                                }
                                if (allopt[i].opttypes=='password'){
                                        document.getElementById("pwd").options.add(new Option(allopt[i].optdesc,allopt[i].optvalues));
                                        // console.log(allopt[i].optvalues);
                                }
                        }
                }

        }

}

